<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="importhead.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="css/addblogeruser.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>   
    <script language="javascript" type="text/javascript" src="js/lib/My97DatePicker/WdatePicker.js"></script>   
    <script type="text/javascript" src="js/ajaxfileupload.js"></script> 
<script type="text/javascript">  
	$(function(){
		$("input") //将html控件实现jqury对象化  
		$("#btnupload").click(function(){ 
			$("#fileToUpload").click();
		});
	    //选择文件之后执行上传  
	    $("#fileToUpload").change(function(){ 
	        
	        $.ajaxFileUpload({                                 
	            url:'fileuploadservlet.do?path=' + $("#userid").val(), 
	            type: "post",   
	            secureuri:false,  
	            fileElementId:'fileToUpload',//file标签的id  
	            dataType: 'json',//返回数据的类型  
	            data:{"titleid":""},//一同上传的数据  
	            success: function (data) {
	                //把图片替换 
					alert(data.result2);
	                $("#upload").attr("src", "/TomcatUpload/"+data.result2);  //将图片路径传给<img 
	      			//将返回值中的文件相对路径及名称写入到文本框中 
	      			$("#photoname").val(data.result1); //将资源码传给 <input
						 alert(data.error_msg);     
	            },  
	            error: function (data, status, e) {  
	                alert(e);  
	            }  
	        });  
	    });  
	      
	});  
	</script>
</head>
<body>
<div id = "leftimg"></div>
<div id = "rightimg"></div>
	<div id= "main">
    
    <div id = "topic"><span>填写博客用户信息</span>
    </div>
    
	  <form method="post" name="edituserform" action="saveblogeruser.do" onsubmit="return editUserValidation()">
      	<table width="80%">
          <tr>
            <td id="edittitle">登录名：</td>
            <td id="editinput">
            <input  class="readyonly" type="text"  name="userid" id="userid"  readOnly="true" value="${user.userid}"/>
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
            <td id="editother" rowspan="5">
            	<img id="upload" src="#" width="160px" height="130px"/>
            	
            </td>
          </tr>
          <tr>
             <td id="edittitle">博客昵称：</td>
            <td id="editinput">
            <input  class="readyonly" type="text" name="nickname" id="nickname" readOnly="true" value="${user.nickname}"/>
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
            
          </tr>
          <tr>
            <td id="edittitle">登录密码：</td>
            <td id="editinput">
            <input  class="readyonly" type="password"  name="pwd" id="pwd" readOnly="true" value="${user.pwd}"/>
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
            
          </tr>
          
          <tr>
             <td id="edittitle">博主照片：</td>
            <td  id="editinput">
      		
            <input class="readyonly" name="photoname" id="photoname" type="text" readOnly="true" value="${user.photoname}" />
            
            <input id = "btnupload" class = "btnphoto" name="btnaddphoto" type="button" value="上传博客照片"/>
           	<!-- 隐藏file标签 -->  
		    <input id="fileToUpload" style="display:none" type="file" name="upfile"/>
            </td>
         	<td id="editremark"></td>
          </tr>
          
          <tr>
             <td id="edittitle">真实姓名：</td>
            <td id="editinput">
            <input type="text" name="realname" id="realname" value=""/>
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
            </tr>
            
          <tr>
             <td id="edittitle">手机号码：</td>
            <td id="editinput">
            <input type="text" name="mobile" id="mobile" value=""/>
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
          </tr>
          
          <tr>
            <td id="edittitle">性别：</td>
            <td id="editinput">
            <input class="radio" type="radio"  name="agend" checked value="男"/> 男
            <input class="radio" type="radio" width="100px" name="agend" value="女" /> 女
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
            <td id="editother">&nbsp; </td>
          </tr>
          <tr>
             <td id="edittitle">出生日期：</td>
            <td id="editinput">
            
            <input type="text" name="birthday" id="birthday" readOnly="true" value=""/>
              <img onClick="WdatePicker({el:$dp.$('birthday')})" src="js/lib/My97DatePicker/skin/datePicker.gif" _fcksavedurl="js/lib/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle"> 
             
            </td>
            <td id="editremark"><span id="remark">必填</span></td>
            <td id="editother">&nbsp; </td>
          </tr>
           
          <tr>
            <td id="edittitle">博签名言：</td>
            <td id="editinput">
            <textarea name="signed" id="signed" cols="40" rows="4"></textarea>
            </td>
            <td id="editremark">&nbsp;</td>
            <td id="editother">&nbsp; </td>
          </tr>
          <tr>
            <td colspan="3">
            <input class="btn" name="reset" type="reset" value="重置" />
            <input class="btn" name="submit" type="submit" value="提交" />
            </td>
            <td>
            <a href="blogermain.do">《返回博客空间主页</a>
            </td>
          </tr>
        </table>

      </form>
    </div>
	 <div class="copyright">
		<p>Copyright © 2014 - Software Technology from <a href="http://www.yngsxy.net/" title="云南工商学院" target="_blank">云南工商学院</a></p> 
 </div>  
</body>
</html>